from selenium.webdriver.common.by import By
from selenium import webdriver
from page_object.common.base_page import Base_Page

class User_Info_Page(Base_Page):
    def __init__(self,driver):
        super().__init__(driver,1)
        # driver = webdriver.Chrome()

    #我的留言
    curs = (By.CLASS_NAME,"curs")
    #留言类型
    curs_style =(By.LINK_TEXT,'留言类型')
    curs_0 =(By.CSS_SELECTOR,'input[value="0"]')
    curs_1 =(By.CSS_SELECTOR,'input[value="1"]')
    curs_2=(By.CSS_SELECTOR,'input[value="2"]')
    curs_3=(By.CSS_SELECTOR,'input[value="3"]')
    curs_4=(By.CSS_SELECTOR,'input[value="4"]')
    curs_title = (By.CSS_SELECTOR,'name="msg_title"')
    input_file = (By.CSS_SELECTOR,'name="message_img"')
    submit = (By.CSS_SELECTOR,'[class="bnt_bonus"]')
    msg_content =(By.CSS_SELECTOR,'name="msg_content"')
    def curs_click(self,):
        self.ele_click(self.curs,'个人信息-我的留言')
    def curs_style_choose(self,index):
        if index == '留言':
            self.ele_click(self.curs_0,'个人信息-留言类型选择留言')
        if index == '投诉':
            self.ele_click(self.curs_1, '个人信息-留言类型选择投诉')
        if index == '询问':
            self.ele_click(self.curs_2, '个人信息-留言类型选择询问')
        if index == '建议':
            self.ele_click(self.curs_3, '个人信息-留言类型选择建议')
        if index == '求购':
            self.ele_click(self.curs_4, '个人信息-留言类型选择求购')

    def input_curs_title(self,title):
        self.ele_input(self.curs_title,'个人信息-输入留言标题',title)

    def input_msg_content(self,content):
        self.ele_input(self.msg_content, '个人信息-输入留言内容',content)

    def file_upload(self,path):

        self.ele_input(self.input_file, '个人信息-文件上传', path)

    def submit_curs(self):
        self.ele_click(self.submit,'个人信息-提交留言')
